<?php
/**
 * EasySEF - SEF component for Joostina CMS.
 * @author:      Лаборатория сайтов, http://sitelab.net.ru
 * @version:     1.1
 * @release:     2010.01.07
 * @package:     com_sef
 * @copyright:   (C) 2010 http://sitelab.net.ru, , see /administrator/components/com_sef/copyright.php
 * @license:     http://www.gnu.org/copyleft/gpl.html GNU/GPL
 *
 * Cоздан на базе sh404SEF  (C) 2007 by Yannick Gaultier
 *
 * easysef support for com_search component.
 * Copyright Yannick Gaultier (shumisha) - 2007
 * shumisha@gmail.com
 * @version     $Id: com_search.php 229 2008-01-21 19:53:39Z silianacom-svn $
 * {shSourceVersionTag: Version x - 2007-09-20}
 */
defined( '_VALID_MOS' ) or die();

// ------------------  standard plugin initialize function - don't change ---------------------------
global $sh_LANG, $sefConfig;  
$shLangName = '';
$shLangIso = '';
$title = array();
$shItemidString = '';
$dosef = shInitializePlugin( $lang, $shLangName, $shLangIso, $option);
if ($dosef == false) return;
// ------------------  standard plugin initialize function - don't change ---------------------------

// ------------------  load language file - adjust as needed ----------------------------------------
$shLangIso = shLoadPluginLanguage( 'com_search', $shLangIso, '_COM_SEF_SH_SEARCH');
// ------------------  load language file - adjust as needed ----------------------------------------                                           


shRemoveFromGETVarsList('option');
shRemoveFromGETVarsList('lang');
shRemoveFromGETVarsList('Itemid');
shRemoveFromGETVarsList('task');
shRemoveFromGETVarsList('limit');
if (isset($limitstart))  // V 1.2.4.r
	shRemoveFromGETVarsList('limitstart'); // limitstart can be zero

//$title[] = getMenuTitle($option, (isset($task) ? @$task : null));
if( isset($tag) ) {
	$title[] = 'tags';
	$title[] = $group;
	$title[] = $tag;
	shRemoveFromGETVarsList('group');
	shRemoveFromGETVarsList('tag');
}else {
	$title[] = $sh_LANG[$shLangIso]['_COM_SEF_SH_SEARCH'];
	$ordering = isset($ordering) ? @$ordering : null;
	switch ($ordering) {
		case 'newest'   :
			$title[] =  $sh_LANG[$shLangIso]['_SEARCH_NEWEST'];
			shRemoveFromGETVarsList('ordering');
			break;
		case 'oldest' :
			$title[] = $sh_LANG[$shLangIso]['_SEARCH_OLDEST'];
			shRemoveFromGETVarsList('ordering');
			break;
		case 'popular' :
			$title[] = $sh_LANG[$shLangIso]['_SEARCH_POPULAR'];
			shRemoveFromGETVarsList('ordering');
			break;
		case 'alpha':
			$title[] = $sh_LANG[$shLangIso]['_SEARCH_ALPHABETICAL'];
			shRemoveFromGETVarsList('ordering');
			break;
	}
}


// ------------------  standard plugin finalize function - don't change ---------------------------  
if ($dosef) {
	$string = shFinalizePlugin( $string, $title, $shAppendString, $shItemidString,
			(isset($limit) ? @$limit : null), (isset($limitstart) ? @$limitstart : null),
			(isset($shLangName) ? @$shLangName : null));
}      
// ------------------  standard plugin finalize function - don't change ---------------------------